const UserService = require("./../service/UserService");
const responseData = require("../utils/responseData");

const UserController = {
  getUser: async (ctx) => {
    const res = await UserService.getUser(ctx.request.query);
    responseData(ctx, res);
  },
  addUser: async (ctx) => {
    const res = await UserService.addUser(ctx.request.body);
    responseData(ctx, res);
  },
  updateUser: async (ctx) => {
    const res = await UserService.updateUser(
      ctx.request.params.id,
      ctx.request.body,
    );
    responseData(ctx, res);
  },
  delUser: async (ctx) => {
    const res = await UserService.delUser(ctx.request.params.id);
    responseData(ctx, res);
  },
};

module.exports = UserController;
